﻿using System;
using System.IO;
using System.Security;

class CompareLines
{
    static void Main()
    {
        try
        {
            using (StreamReader firstFile = new StreamReader("C:\\WINDOWS\\win.ini"))
            {
                using (StreamReader secondFile = new StreamReader("C:\\WINDOWS\\win.ini"))
                {
                    string firstFileCurrentLine;
                    string secondFileCurrentLine;

                    int equal = 0;
                    int unequal = 0;

                    while ((firstFileCurrentLine = firstFile.ReadLine()) != null && (secondFileCurrentLine = secondFile.ReadLine()) != null)
                    {
                        if (String.Compare(firstFileCurrentLine, secondFileCurrentLine) == 0)
                        {
                            equal++;
                        }
                        else
                        {
                            unequal++;
                        }
                    }

                    Console.WriteLine("Equal lines are {0}", equal);
                    Console.WriteLine("Unequal lines are {0}", unequal);
                }
            }
        }
        catch (FileNotFoundException)
        {
            Console.WriteLine("Cannot find one/all of file(s)");
        }
        catch (DirectoryNotFoundException)
        {
            Console.WriteLine("Invalid Folder ");
        }
        catch (PathTooLongException)
        {
            Console.WriteLine("The path is too long");
        }
        catch (UnauthorizedAccessException)
        {
            Console.WriteLine("You don`t have access!");
        }
        catch (NotSupportedException)
        {
            Console.WriteLine("Cannot open this file!");
        }
        catch (SecurityException)
        {
            Console.WriteLine("Not enough permission to open file!");
        }
    }
}